Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: adds validation for siteid #349 #350

Merged
merged 2 commits into from
Dec 12, 2023
Merged

bug: adds validation for siteid #349 #350

merged 2 commits into from
Dec 12, 2023

Conversation

srinandan
Copy link
Collaborator

No description provided.

@srinandan srinandan linked an issue Dec 4, 2023 that may be closed by this pull request
Copy link
Collaborator

@kurtkanaskie kurtkanaskie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In cmd/apidocs/apidocs.go why doesn't this line make siteid required:
_ = Cmd.MarkFlagRequired("siteid")

And why is siteid a global on list?

gorun apidocs list --help
Returns the catalog items associated with a portal

Usage:
  apigeecli apidocs list [flags]

Flags:
  -h, --help   help for list

Global Flags:
  -a, --account string   Path Service Account private key in JSON
      --default-token    Use Google default application credentials access token
      --disable-check    Disable check for newer versions
      --metadata-token   Metadata OAuth2 access token
      --no-output        Disable printing all statements to stdout
  -o, --org string       Apigee organization name
      --print-output     Control printing of info log statements (default true)
  -s, --siteid string    Name or siteid of the portal
  -t, --token string     Google OAuth Token

vs here, it's not in global

gorun apidocs --help
Manage Apigee API catalog item through ApiDoc

Usage:
  apigeecli apidocs [command]

Available Commands:
  create        Create a new catalog item
  delete        Deletes a catalog item
  documentation Manage the documentation for the specified catalog item
  get           Gets a catalog item
  list          Returns the catalog items associated with a portal
  update        Update an existing catalog item

Flags:
  -h, --help            help for apidocs
  -o, --org string      Apigee organization name
  -s, --siteid string   Name or siteid of the portal

Global Flags:
  -a, --account string   Path Service Account private key in JSON
      --default-token    Use Google default application credentials access token
      --disable-check    Disable check for newer versions
      --metadata-token   Metadata OAuth2 access token
      --no-output        Disable printing all statements to stdout
      --print-output     Control printing of info log statements (default true)
  -t, --token string     Google OAuth Token

@srinandan
Copy link
Collaborator Author

Regarding,

In cmd/apidocs/apidocs.go why doesn't this line make siteid required:
_ = Cmd.MarkFlagRequired("siteid")

I don't know. I expected it to be which is why I didn't have the validation. Turns out the field is not mandatory and I got errors.

Regarding
And why is siteid a global on list? This is the behavior the library. If you notice, org also behaves the same way.

@kurtkanaskie
Copy link
Collaborator

LGTM, I understand it's how the library works.

@srinandan srinandan merged commit 40cac48 into main Dec 12, 2023
5 checks passed
@srinandan srinandan deleted the issue349 branch December 12, 2023 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

siteid is not validated as a mandatory param
2 participants